import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import tailwindcss from '@tailwindcss/vite'

export default defineConfig({
    base: '',
    plugins: [
        vue(),
        tailwindcss(),
        vueDevTools(),
    ],
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url))
        },
    },
    build: {
        outDir: 'dist/test1',
        emptyOutDir: false,
        rollupOptions: {
            output: {
                entryFileNames: `test1.js`,
                assetFileNames: (assetInfo) => {
                    if (assetInfo.name?.endsWith('.css')) {
                        return 'test1.css';
                    }
                    return '[name]-[hash][extname]';
                },
            },
        },
    }
})
